using IM.Easy.Core.ServiceLifetime;
using IM.Easy.Core.Services;
using IM.Easy.Core.Utils;
using IM.Easy.Infrastructure.Query;
using IM.Easy.Entity.System;
using IM.Easy.SystemServices.Dtos.Department;

namespace IM.Easy.SystemServices.IServices
{
    public interface IDepartmentService : IAppServices<SysDepartment>
    {
        /// <summary>
        /// 创建一个新实体
        /// </summary>
        /// <param name="entity">要创建的实体</param>
        /// <returns>创建后的实体</returns>
        DepartmentResponseDto Create(SysDepartmentCreateDto entity);

        /// <summary>
        /// 根据 ID 获取实体
        /// </summary>
        /// <param name="id">实体的唯一标识</param>
        /// <returns>获取的实体</returns>
        DepartmentResponseDto GetOrg(long id);

        /// <summary>
        /// 获取所有实体
        /// </summary>
        /// <returns>所有实体的列表</returns>
        PageResponse<DepartmentResponseDto> GetPageList(SysDepartmentQueryDto query);

        /// <summary>
        /// 获取部门组织树
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        List<DepartmentResponseDto> GetTree(SysDepartmentTreeQueryDto query);

        /// <summary>
        /// 获取未知部门
        /// </summary>
        DepartmentResponseDto GetUnknowDepartment();

        /// <summary>
        /// 查询所有子部门
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        List<DepartmentResponseDto> GetChildrens(SysDepartmentTreeQueryDto query);

        /// <summary>
        /// 更新一个已有的实体
        /// </summary>
        /// <param name="entity">更新后的实体</param>
        /// <returns>更新后的实体</returns>
        bool Update(SysDepartmentCreateDto entity);

        /// <summary>
        /// 删除部门
        /// </summary>
        /// <returns></returns>
        bool DeleteDept(long id);

        /// <summary>
        /// 通过部门管理员获取部门
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        List<DepartmentResponseDto> GetByManager(long id);

        /// <summary>
        /// 更新组织类型
        /// </summary>
        /// <param name="orgTypeDto"></param>
        /// <returns></returns>
        bool SetOrgType(SysOrgTypeDto orgTypeDto);

        /// <summary>
        /// 获取导出的组织机构数据
        /// </summary>
        List<OrgExcelDto> GetExportOrg(SysDepartmentQueryDto param);
    }
}
